package cn.dujc.superkid.adapter;

import android.support.annotation.Nullable;
import android.text.Html;

import java.util.List;

import cn.dujc.core.adapter.BaseAdapter;
import cn.dujc.core.adapter.BaseViewHolder;
import cn.dujc.superkid.R;
import cn.dujc.superkid.bean.MyTestMessageResult;
import cn.dujc.superkid.utils.DateUtil;

public class MeExamMessageAdapter extends BaseAdapter<MyTestMessageResult.MyTestMessageEntity> {
    public MeExamMessageAdapter(@Nullable List<MyTestMessageResult.MyTestMessageEntity> data) {
        super(data);
        mLayoutResId= R.layout.que_ans_item;
    }

    @Override
    protected void convert(BaseViewHolder helper, MyTestMessageResult.MyTestMessageEntity item) {
        long problem_posttime = Long.valueOf(item.getPosttime()).longValue();
        String posttime= DateUtil.formatData("yyyy-MM-dd HH:mm:ss",problem_posttime);
        helper.setText(R.id.que_time,posttime);
        helper.setText(R.id.question,item.getContent());
        if(item.getStatus().equals("1")){
            helper.setGone(R.id.rl_alreadyprocessed,false);
            helper.setGone(R.id.rl_untreated,true);
        }else {
            long answer_posttime = Long.valueOf(item.getAnswer_posttime()).longValue();
            String posttime2=DateUtil.formatData("yyyy-MM-dd HH:mm:ss",answer_posttime);
            helper.setText(R.id.teacher_time,posttime2);
//            ImageLoadHelper.loadImage((ImageView) helper.getView(R.id.teacher_icon),item.getAnswer_teacher_avatar());//暂无头像
//            helper.setText(R.id.teacher_name,item.getAnswer_teacher_nicename());
            helper.setText(R.id.teacher_answer, Html.fromHtml(item.getAnswer_content()));
            helper.setGone(R.id.rl_alreadyprocessed,true);
            helper.setGone(R.id.rl_untreated,false);
        }
    }
}
